package com.fdd.furns.service.impl;

import com.fdd.furns.dao.MemberDAO;
import com.fdd.furns.dao.impl.MemberDAOImpl;
import com.fdd.furns.entity.Member;
import com.fdd.furns.service.MemberService;

public class MemberServiceImpl implements MemberService {
    //定义一个MemberDao属性
    private MemberDAO memberDAO = new MemberDAOImpl();

    @Override
    public boolean registerMember(Member member) {
        return memberDAO.saveMember(member) == 1;
    }

    @Override
    public boolean isExistUsername(String username) {
        return memberDAO.queryMemberByUsername(username) != null;
    }

    @Override
    public Member login(Member member) {
        return memberDAO.queryMemberByUsernameAndPassword(member.getUsername(), member.getPassword());
    }


}
